//
//  yanzhengController.m
//  weiAai
//
//  Created by ibokan on 14-12-15.
//  Copyright (c) 2014年 ibokan. All rights reserved.
//

#import "yanzhengController.h"
#import "AFNetworking.h"
#import "firstViewController.h"
@interface yanzhengController ()

@end

@implementation yanzhengController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"yanzheng");
    self.title = @"登录";
    NSLog(@"%@",self.navigationController.viewControllers);
    
//    [self dowlow];
//    [self setupButton];
}
-(void)setupButton
{
    NSLog(@"setupButton");
    UIButton *button =[[UIButton alloc]init];
    
    button.frame =CGRectMake(156, 250, 90, 30);
    [button setTitle:@"确定" forState:UIControlStateNormal];
    button.backgroundColor =[UIColor redColor];
    [button addTarget:self action:@selector(tiaozhuan) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

}
-(void)tiaozhuan
{

}
-(void)dowlow
{
    AFHTTPRequestOperationManager *manger =[AFHTTPRequestOperationManager manager];
  
 
   NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    manger.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
   // dic[@"client_id"]=@"4236150992";
   // dic[@"client_secret"]=@"17e7a0c2381ba6e6c7b9bb7bf020620c";
  //  dic[@"grant_type"]=@"authorization_code";
   // dic[@"code"]=code;
  //  dic[@"redirect_uri"]=@"http://www.baidu.com";
    NSString *token = [[NSUserDefaults standardUserDefaults]objectForKey:@"access_token"];
    NSString *uid = [[NSUserDefaults standardUserDefaults]objectForKey:@"userID"];
    dic[@"uid"] =uid;
    dic[@"access_token"] =token;
  
   [manger POST:@"http://lovemyqq.sinaapp.com/login.php" parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
       NSLog(@"%@",responseObject);
       firstViewController *zhuce =[[firstViewController alloc]init];
       [self.navigationController pushViewController:zhuce animated:YES];
   } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
       NSLog(@"%@",error);
   }];
}

@end
